package server.controller.auctionController;

import server.entity.Auction;
import server.model.factory.ModelFactory;
import server.util.InfoUtils.Info;
import server.util.MyUtils;
import server.util.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//商家创建拍卖
@WebServlet("/addAuction")
public class AddAuctionServlet extends HttpServlet {
    private static final long serialVersionUID = -3044789546586937293L;

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Info info = null;
        Auction auction = MyUtils.convertRequest2Bean(req, Auction.class);
        System.out.println();
        info = ModelFactory.getAuctionModel().addAuction(auction);

        ResponseUtil.responseMessage(resp, info);
    }
}
